package cn.leonis.consumer01.controller;

import cn.leonis.consumer01.pojo.Order;
import cn.leonis.consumer01.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    private final OrderService orderService;

    @Autowired
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @GetMapping("/order/{id}")
    public Order selectById(@PathVariable("id") Integer id) {
        final Order order = orderService.selectOrderById(id);
        return order;
    }
}
